package com.endava.exceptions.propagation;

/**
 * The propagation of errors, which work as uncheked exceptions. The compiler
 * does not impose to declare or handle it. The error will propagate and be
 * thrown.
 * 
 * @author Andreea
 * 
 */
public class TextExError {
	public static void main(String[] args) {
		badMethod();
	}

	static void badMethod() { // No need to declare an Error
		doStuff();
	}

	static void doStuff() { // No need to declare an Error
		try {
			throw new Error();
		} catch (Error me) {
			throw me; // We catch it, but then rethrow it
		}
	}
}